// Brackets Removal, NEERC 2005, POJ2792
// 陈锋
#include <iostream>
#include <cassert>
#include <cctype>
using namespace std;
const int MAXN = 1024;

struct Node {
  char ch;
  Node *left, *right;
  bool enclose; // 是否在括号内
  int priority; // 优先级
  Node(char c = 0) : ch(c), left(NULL), right(NULL), enclose(false), priority(0) {
    if (ch == '*' || ch == '/') priority = 2;
    else if (ch == '+' || ch == '-') priority = 1;
  }
  bool isOp() const { return !islower(ch); }
  ~Node() { // 析构函数，递归释放内存
    if (left) delete left;
    if (right) delete right;
  }
};
typedef Node* PNode;
string EX;
PNode pRoot;

ostream& operator<<(ostream& os, const PNode p) {
  if (!p) return os;
  if (p->enclose) os << '(';
  os << p->left << p->ch << p->right;
  if (p->enclose) os << ')';
  return os;
}

void reverse(PNode p) {
  assert(p);
  assert(p->isOp());
  char c = p->ch;
  switch (c) {
  case '+' : p->ch = '-'; break;
  case '-' : p->ch = '+'; break;
  case '*' : p->ch = '/'; break;
  case '/' : p->ch = '*'; break;
  default:
    assert(false);
  }

  PNode pl = p->left, pr = p->right;
  if (pl && pl->isOp() && pl->priority == p->priority) reverse(pl);
  if (pr && pr->isOp() && !pr->enclose && pr->priority == p->priority) reverse(pr);
}

void proc(PNode p) {
  assert(p);
  if (!p->isOp()) return;
  PNode pl = p->left, pr = p->right;
  if (pl && pl->isOp()) {
    if (pl->priority >= p->priority) pl->enclose = false;
    proc(pl);
  }

  if (pr && pr->isOp()) {
    if (pr->priority > p->priority) pr->enclose = false;
    else if (pr->priority == p->priority) {
      if ((p->ch == '/' || p->ch == '-') && pr->enclose)
        pr->enclose = false, reverse(pr);
      pr->enclose = false;
    }
    proc(pr);
  }
}

PNode parse(int l, int r) {
  assert(l <= r);
  char lc = EX[l];
  if (l == r) return new Node(lc);

  int p = 0, c1 = -1, c2 = -1;
  for (int i = l; i <= r; i++) {
    switch (EX[i]) {
    case '(' : p++; break;
    case ')' : p--; break;
    case '+' : case '-' : if (!p) c1 = i; break;
    case '*' : case '/' : if (!p) c2 = i; break;
    }
  }

  if (c1 < 0) c1 = c2;
  if (c1 < 0) {
    PNode ans = parse(l + 1, r - 1);
    ans->enclose = true;
    return ans;
  }

  PNode ans = new Node(EX[c1]);
  PNode ln = ans->left = parse(l, c1 - 1), rn = ans->right = parse(c1 + 1, r);
  assert(ans->priority);
  if (!ln->isOp()) ln->enclose = false;
  if (!rn->isOp()) rn->enclose = false;
  return ans;
}

int main() {
  while (cin >> EX) {
    pRoot = parse(0, EX.size() - 1);
    pRoot->enclose = false;
    proc(pRoot);
    cout << pRoot << endl;
    delete pRoot;
  }
  return 0;
}
/*
算法分析请参考: 《入门经典-习题与解答》习题11-6
注意本题中如何使用析构函数来实现递归释放整棵树的内存
以及对<<操作符的重载实现整棵树的递归输出
*/
// Accepted 219ms 704kB 2695 G++ 2020-12-13 17:23:42 22207565